<template>
  <div class="app">
    父组件: <input type="text">
    <div v-color="color1">我就是父元素1</div>

    <div v-color="color2">我就是父元素2</div>
    
    
    
     <br/>
    <SonCom />
  </div>
</template>

<script>
//需求: 通过指令设置元素的字体颜色
import SonCom from './components/SonCom'
export default {
  data() {
    return {
      color1: 'red',
      color2: 'blue'
    }
  },
  directives: {
    color: {
      inserted(el, binding) {
        console.log(el, binding);
        // 操作style 修改样式
        el.style.color = binding.value
      }
    }
  },
  components: {
    SonCom

  },
  mounted() {
    
  },
  methods: {
  }
}
</script>

<style>
</style>